CuDoubleSidedScannerC  1.22
D:/MyProject/VC++ ver 13.00/CuDoubleSidedScannerC/CuDoubleSidedScannerC/CuDoubleSidedScannerC.cpp File Reference

Contains all library APIs. Main file for CuDoubleSidedScannerC library. More...

Functions

DssResult WINAPI InitLibrary (LogVerbosity logVerbosityLevel, ScannerDevice *pDevicesList, LPDWORD pdwDeviceNum, wchar_t *szLogFilePath, DWORD dwWorkingParam)
 
DssResult WINAPI DeInitLibrary ()
 
DssResult WINAPI GetDevicesAvailable (ScannerDevice *pDevicesList, LPDWORD pdwDeviceNum)
 
DssResult WINAPI ConnectScanner (DeviceID device)
 
DssResult WINAPI Disconnect (DeviceID device)
 
DssResult WINAPI GetLibraryRelease (CHAR *cLibRel, DWORD dwBuffSizeChar)
 
DssResult WINAPI GetScannerStatus (DeviceID device, ScannerStatusStruct *pStatus)
 
DssResult WINAPI HardwareReset (DeviceID device)
 
DssResult WINAPI HardwareResetRT (DeviceID device)
 
DssResult WINAPI GetLastScanImageData (DeviceID device, ImageFromScannerStruct *pImageSideA, ImageFromScannerStruct *pImageSideB)
 
DssResult WINAPI StartScan (DeviceID device, ScanParametersStruct *pCurrentParameters, LPDWORD pdwImageSizeSideA, LPDWORD pdwImageSizeSideB)
 
DssResult WINAPI CheckScanParameters (DeviceID device, ScanParametersStruct *pCurrentParameters)
 
DssResult WINAPI GetFirmwareRelease (DeviceID device, CHAR *szFwRel, DWORD dwRelOutSize)
 
DssResult WINAPI GetHardwareRelease (DeviceID device, CHAR *szHwRel, DWORD dwRelOutSize)
 
DssResult WINAPI GetModelRelease (DeviceID device, CHAR *szModelRel, DWORD dwRelOutSize)
 
DssResult WINAPI GetScanCounter (DeviceID device, DWORD *pdwScanCounter)
 
DssResult WINAPI GetVoidPrintedPaperLen (DeviceID device, DWORD *pdwPrintedPaperCm)
 
DssResult WINAPI GetMICRData_CMC7 (DeviceID device, BYTE *bufferData, DWORD dwBufferSize, LPDWORD pdwDataSize)
 
DssResult WINAPI MoveForm (DeviceID device, FormMovement *pMovement)
 
DssResult WINAPI GetUltrasonicParameters (DeviceID device, UltrasonicParametersStruct *pUltraParams)
 
DssResult WINAPI SetUltrasonicParameters (DeviceID device, UltrasonicParametersStruct *pUltraParams)
 
DssResult WINAPI SetLedBar (DeviceID device, LedBarSetting *pLedBarSettings)
 
DssResult WINAPI UpdateFirmware (DeviceID device, wchar_t *fileNameAndPath, BOOL bCheckFileValidity)
 
DssResult WINAPI IsOnline (DeviceID device)
 
DssResult WINAPI DisengageScanner (DeviceID device, FormStanding *pMovement, DWORD dwTimeout)
 
DssResult WINAPI SetBWThreshold (DeviceID device, BYTE bBWThreshold)
 
DssResult WINAPI GetBWThreshold (DeviceID device, BYTE *pbBWThreshold)
 
DssResult WINAPI SetCropParameters (DeviceID device, CropParametersStruct *pCurrentCropParameters)
 
DssResult WINAPI GetCropParameters (DeviceID device, CropParametersStruct *pCurrentCropParameters)
 
DssResult WINAPI GetCapabilities (DeviceID device, ScannerCapabilities *pCapabilities)
 
DssResult WINAPI ClearImagesData (DeviceID device)
 
DssResult WINAPI VoidTicket (DeviceID device, LPBYTE pBufferData, DWORD dwBufferSize, DWORD dwYMovementInDot, FormStanding movementAfterVoid, ScannerPrintDensity printDensity, DWORD dwReserved)
 
DssResult WINAPI SetRejectMargins (DeviceID device, BYTE bRejectMarginL, BYTE bRejectMarginR)
 
DssResult WINAPI SetColorGamma (DeviceID device, ScanSide sideToSet, BYTE colorChannelBitMask, USHORT clipBlack, USHORT clipWhite, BYTE gamma10, BYTE *reserved, DWORD dwReservedSize)
 
DssResult WINAPI SetColorGammaCurves (DeviceID device, ScanSide sideToSet, GammaChannel gChannel, BYTE *bDataValue, DWORD dwDataValueSize)
 

Detailed Description

Contains all library APIs. Main file for CuDoubleSidedScannerC library.

Function Documentation

◆ CheckScanParameters()

DssResult WINAPI CheckScanParameters ( DeviceID  device,
ScanParametersStruct *  pCurrentParameters 
)

Checks if the parameters indicated by *pCurrentParameters are correct for this device.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]pCurrentParametersAll the image parameters for the next scan job.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ ClearImagesData()

DssResult WINAPI ClearImagesData ( DeviceID  device)

Clears the memory for last scanned image/images. Call this API is not mandatory: previous image data will be automatically deleted during the following scan job .

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ ConnectScanner()

DssResult WINAPI ConnectScanner ( DeviceID  device)

Connect to the scanner. This function must be called once, just after InitLibrary.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to. This value corresponds to ScannerDevice::dwDeviceID present in each ScannerDevice in pDevicesList list, retreived by InitLibrary.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.
See also
Disconnect
Init and deinit library flowchart.

◆ DeInitLibrary()

DssResult WINAPI DeInitLibrary ( )

De-initialize dll. Call this function as the last function before your application unloads the library.

Returns
A DssResult error code, or DssResult_OK if the function succeeded.
See also
InitLibrary
Init and deinit library flowchart.

◆ Disconnect()

DssResult WINAPI Disconnect ( DeviceID  device)

Disconnect the scanner connection. This function must be called just before DeInitLibrary.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to. This value corresponds to ScannerDevice::dwDeviceID present in each ScannerDevice in pDevicesList list, retreived by InitLibrary.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.
See also
ConnectScanner
Init and deinit library flowchart.

◆ DisengageScanner()

DssResult WINAPI DisengageScanner ( DeviceID  device,
FormStanding *  pMovement,
DWORD  dwTimeout 
)

Tries to disengage scanner from a paper form. Try to move the paper form forward or backward, depending on *pMovement. Retries for a maximum of dwTimeout seconds.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]pMovementIndicates wheter the paper has to be moved forward or backward.
[in]dwTimeoutMax retry timeout, in seconds. Advised value is at least 30 seconds.
Returns
DssResult_OK if the operation succeeds or if there is no paper engaging the scanner; returns DSSResult_ScannerJam if it was not possible to disengage the scanner. Returns a DssResult error code in all other error cases.

◆ GetBWThreshold()

DssResult WINAPI GetBWThreshold ( DeviceID  device,
BYTE *  pbBWThreshold 
)

Gets the Threshold value for Black & White conversion.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]pbBWThresholdBlack & White Threshold.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ GetCapabilities()

DssResult WINAPI GetCapabilities ( DeviceID  device,
ScannerCapabilities *  pCapabilities 
)

Returns a scanner capabilities list.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]pCapabilitiesA pointer indicating the scanner capabilities. This structure must have been allocated by the calling process.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ GetCropParameters()

DssResult WINAPI GetCropParameters ( DeviceID  device,
CropParametersStruct *  pCurrentCropParameters 
)

Gets the current Parameters for Crop / Deskew operations.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]pCurrentCropParametersCrop / Deskew Threshold for edges identification.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ GetDevicesAvailable()

DssResult WINAPI GetDevicesAvailable ( ScannerDevice *  pDevicesList,
LPDWORD  pdwDeviceNum 
)

Get Devices list. Returns the Array of ScannerDevice.

Parameters
[out]pDevicesListArray of ScannerDevice allocated by the calling process. It will contain data about the connected compatible scanners.
[in,out]pdwDeviceNumPointer to a DWORD that indicates the number of devices present in *pDevicesList array. In input, indicates the allocated number of elements of pDevicesList, in output indicates the found number of devices, that is the valid element in pDevicesList.

◆ GetFirmwareRelease()

DssResult WINAPI GetFirmwareRelease ( DeviceID  device,
CHAR *  szFwRel,
DWORD  dwRelOutSize 
)

Get scanner firmware release.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]szFwRelA null terminated string containing the scanner firmware release. This buffer must have been allocated by the calling process.
[in]dwRelOutSizesize of szFwRel, in CHAR
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ GetHardwareRelease()

DssResult WINAPI GetHardwareRelease ( DeviceID  device,
CHAR *  szHwRel,
DWORD  dwRelOutSize 
)

Get scanner hardware release.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]szHwRelA null terminated string containing the scanner hardware release. This buffer must have been allocated by the calling process.
[in]dwRelOutSizesize of szHwRel, in CHAR
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ GetLastScanImageData()

DssResult WINAPI GetLastScanImageData ( DeviceID  device,
ImageFromScannerStruct *  pImageSideA,
ImageFromScannerStruct *  pImageSideB 
)

Gets the last scanned image (or images).

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]pImageSideAA pointer to a struct containing the last scanned image on side A (also called side UP or front side). Can be NULL if a side A scan was not requested during the last scan. Structure and the contained buffers must be allocated by the calling process.
[out]pImageSideBB pointer to a struct containing the last scanned image on side B (also called side DOWN or back side). Can be NULL if a side B scan was not requested during the last scan. Structure and the contained buffers must be allocated by the calling process.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.
See also
How to get scan image flowchart.

◆ GetLibraryRelease()

DssResult WINAPI GetLibraryRelease ( CHAR *  cLibRel,
DWORD  dwBuffSizeChar 
)

Get library release.

Parameters
[out]cLibRelA null terminated string containing the library release. This buffer must have been allocated by the calling process.
[in]dwBuffSizeCharsize of cLibRel, in CHAR
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ GetMICRData_CMC7()

DssResult WINAPI GetMICRData_CMC7 ( DeviceID  device,
BYTE *  bufferData,
DWORD  dwBufferSize,
LPDWORD  pdwDataSize 
)

Get magnetic ink characters for CMC 7 standard. Scanner decodes magnetic data during a scan job. If bufferData == NULL or dwBufferSize == 0, return DssResult_SmallBuffer and in *pdwDataSize the needed buffer size.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]bufferDataA buffer containing CMC7 data. This buffer must have been allocated by the calling process. Data size is always less or equal to 256 bytes.
[in]dwBufferSizeSize of bufferData, in bytes.
[out]pdwDataSizeSize, in bytes, of valid data contained in bufferData
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ GetModelRelease()

DssResult WINAPI GetModelRelease ( DeviceID  device,
CHAR *  szModelRel,
DWORD  dwRelOutSize 
)

Get scanner model release.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]szModelRelA null terminated string containing the scanner model release. This buffer must have been allocated by the calling process.
[in]dwRelOutSizesize of szModelRel, in CHAR
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ GetScanCounter()

DssResult WINAPI GetScanCounter ( DeviceID  device,
DWORD *  pdwScanCounter 
)

Get the number of the total scan jobs performed by the scanner.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]pdwScanCounterA pointer to the number of total performed scan jobs.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ GetScannerStatus()

DssResult WINAPI GetScannerStatus ( DeviceID  device,
ScannerStatusStruct *  pStatus 
)

Gets the scanner status info.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]pStatusA pointer to ScannerStatusStruct, allocated by the calling process, thatcontains the scanner status information.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ GetUltrasonicParameters()

DssResult WINAPI GetUltrasonicParameters ( DeviceID  device,
UltrasonicParametersStruct *  pUltraParams 
)

Gets the scanner ultrasonic parameters (if supported by the device) from the RAM.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]pUltraParamsA user allocated struct containing the parameters.
Returns
A DssResult error code, or DssResult_OK if the function succeeded. If pbufSerialNumber == NULL, returns DssResult_SmallBuffer and in *pdwSerialNumberLength the needed buffer size.

◆ GetVoidPrintedPaperLen()

DssResult WINAPI GetVoidPrintedPaperLen ( DeviceID  device,
DWORD *  pdwPrintedPaperCm 
)

Get the lenght, in cm, of the total printed paper during "void" operations.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]pdwPrintedPaperCmA pointer to the total amount, in cm, of printed paper.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ HardwareReset()

DssResult WINAPI HardwareReset ( DeviceID  device)

Performs a scanner hardware reset. The command is sent on the scan communication interface, so it will be queued to other commands. This operation could take several seconds, and this function returns when the scanner is returned online. The scanner connection will automatically reopen.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ HardwareResetRT()

DssResult WINAPI HardwareResetRT ( DeviceID  device)

Performs a scanner hardware reset. The command is sent on the real time communication interface, so it immediately processed by the scanner: it will stop the execution of other operations in progress, if there are ones. This operation could take several seconds, and this function returns when the scanner is returned online. The scanner connection will automatically reopen.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ InitLibrary()

DssResult WINAPI InitLibrary ( LogVerbosity  logVerbosityLevel,
ScannerDevice *  pDevicesList,
LPDWORD  pdwDeviceNum,
wchar_t *  szLogFilePath,
DWORD  dwWorkingParam 
)

Initializes library. This must be the first call after the LoadLibrary.

Parameters
[in]logVerbosityLevelVerbosity level.
[out]pDevicesListArray of ScannerDevice allocated by the calling process. It will contain data about the connected compatible scanners.
[in,out]pdwDeviceNumPointer to a DWORD that indicates the number of devices present in *pDevicesList array. In input, indicates the allocated number of elements of pDevicesList, in output indicates the found number of devices, that is the valid element in pDevicesList.
[in]szLogFilePathLog file path. If NULL, the library uses the default path: "%Documents and settings%\CUSTOM\CuDoubleSidedScannerAPI\Log". The file name is "DoubleSidedScannerC.log".
[in]dwWorkingParamUsed to set library working parameters. It is possible to set one or more WorkingParameter. To set more than one WorkingParameter, use dwWorkingParam as a sum of the wanted WorkingParameter values. 0 by default.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.
See also
DeInitLibrary
Init and deinit library flowchart.

◆ IsOnline()

DssResult WINAPI IsOnline ( DeviceID  device)

Checks if the scanner communication is ON.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
Returns
DssResult_OK if the communication is ON, or DssResult error code if there is any trouble.

◆ MoveForm()

DssResult WINAPI MoveForm ( DeviceID  device,
FormMovement *  pMovement 
)

Moves the paper form in the way indicated by *pMovement.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]pMovementWhich kind of paper movement the scanner has to perform.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ SetBWThreshold()

DssResult WINAPI SetBWThreshold ( DeviceID  device,
BYTE  bBWThreshold 
)

Sets the Threshold value for Black & White conversion.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]bBWThresholdBlack & White Threshold.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ SetColorGamma()

DssResult WINAPI SetColorGamma ( DeviceID  device,
ScanSide  sideToSet,
BYTE  colorChannelBitMask,
USHORT  clipBlack,
USHORT  clipWhite,
BYTE  gamma10,
BYTE *  reserved,
DWORD  dwReservedSize 
)

Set color gamma parameters for the following scan job. Only for DeviceModel::A4_Scanner scanners.

Note
The parameters will be reset after the following scan job, also if the scan job fails for any reason. So, call SetColorGamma before every scan job.
Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]sideToSetWhich scan side has to be set. It is possible to select both side A+B.
[in]colorChannelBitMaskWhich color channel has to be set. It is possible to select more than one color channel, using color channels as bitmasks.
[in]clipBlackValue from 0 to 150, to clip color to black. Default value is 15.
[in]clipWhiteValue from 100 to 256, to clip color to white. Default value is 200.
[in]gamma10Specifies gamma value to build map curve. From 5 to 50. (16 means 1.6, 20 means 2.0). Default value is 20.
[in]reservedSet to NULL. Reserved for future developments. SET TO NULL.
[in]dwReservedSizeSet to 0. Reserved for future developments. Set to 0.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ SetColorGammaCurves()

DssResult WINAPI SetColorGammaCurves ( DeviceID  device,
ScanSide  sideToSet,
GammaChannel  gChannel,
BYTE *  bDataValue,
DWORD  dwDataValueSize 
)

Set color gamma curves for the following scan job. Only for DeviceModel::A4_216_Void_Scanner DeviceModel::A6_Scanner scanners.

Note
The parameters will be reset after the reset or power off, socall SetColorGammaCurves before start the scan jobs.
Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]sideToSetWhich scan side has to be set. It is possible to select both side A+B.
[in]gChannelGammaChannel Which color channel has to be set
[in]bDataValuebuffer with the 256 bytes of the channel curve values.
[in]dwDataValueSizesize of buffer with the curve values. Must bel always 256.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ SetCropParameters()

DssResult WINAPI SetCropParameters ( DeviceID  device,
CropParametersStruct *  pCurrentCropParameters 
)

Sets the current Parameters for Crop / Deskew operations.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]pCurrentCropParametersCrop / Deskew Threshold for edges identification. The value must be in the range 0-255 (128 default)
Returns
This function must be call only one time after the init.
Note
This.

◆ SetLedBar()

DssResult WINAPI SetLedBar ( DeviceID  device,
LedBarSetting *  pLedBarSettings 
)

Sets the led bar working parameters

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]pLedBarSettingsPointer a struct containing all led bar settings.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ SetRejectMargins()

DssResult WINAPI SetRejectMargins ( DeviceID  device,
BYTE  bRejectMarginL,
BYTE  bRejectMarginR 
)

Sets the Reject Margins

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]bRejectMarginLLeft Margin for Reject. Each step corresponds to 32pixels. The value must be in the range 0-15 (0 default).
[in]bRejectMarginRRight Margin for Reject. Each step corresponds to 32pixels. The value must be in the range 0-15 (0 default).
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ SetUltrasonicParameters()

DssResult WINAPI SetUltrasonicParameters ( DeviceID  device,
UltrasonicParametersStruct *  pUltraParams 
)

Sets the scanner ultrasonic parameters (if supported by the device) into the RAM.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[out]pUltraParamsA user allocated struct containing the parameters.
Returns
A DssResult error code, or DssResult_OK if the function succeeded. If pbufSerialNumber == NULL, returns DssResult_SmallBuffer and in *pdwSerialNumberLength the needed buffer size.

◆ StartScan()

DssResult WINAPI StartScan ( DeviceID  device,
ScanParametersStruct *  pCurrentParameters,
LPDWORD  pdwImageSizeSideA,
LPDWORD  pdwImageSizeSideB 
)

Starts a scan job, according with scan parameters indicated by *pCurrentParameters. This function returns when the scan job has finished.

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]pCurrentParametersAll the image parameters for the next scan job.
[out]pdwImageSizeSideAPointer to the size, in bytes, of the image scanned on side A (up side). 0 if no scan is expected on side A.
[out]pdwImageSizeSideBPointer to the size, in bytes, of the image scanned on side B (down side). 0 if no scan is expected on side B.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.
See also
How to get scan image flowchart.

◆ UpdateFirmware()

DssResult WINAPI UpdateFirmware ( DeviceID  device,
wchar_t *  fileNameAndPath,
BOOL  bCheckFileValidity 
)

Performs a firmware update. This operation culd take several seconds. Don't call other scanner API during this operation. Returns when the scanner is online

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]fileNameAndPathPSW Update file name and path.
[in]bCheckFileValidityIf TRUE, the API will check the file validity before start update the firmware. Using TRUE is ADVISED. Use FALSE only when strictly necessary.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.

◆ VoidTicket()

DssResult WINAPI VoidTicket ( DeviceID  device,
LPBYTE  pBufferData,
DWORD  dwBufferSize,
DWORD  dwYMovementInDot,
FormStanding  movementAfterVoid,
ScannerPrintDensity  printDensity,
DWORD  dwReserved 
)

Voids the ticket inserted

Parameters
[in]deviceThe device ID indicating which device the application will communicate to.
[in]pBufferDataThe buffer containing the data to be sent to the printer to void the ticket.
[in]dwBufferSizeSize of pBufferData, in bytes
[in]dwYMovementInDotThe number of dots the ticket must be moved back to align it for printing.
[in]movementAfterVoidIndicates which movement must perform the ticket after being voided: to be ejected forward, retracted backward, or kept hold for further commands by the user
[in]printDensityThe print density
[in]dwReservedReserved. Set to 0.
Returns
A DssResult error code, or DssResult_OK if the function succeeded.